<template>
  <button @click="isDisplay = !isDisplay">显示或隐藏</button>
  <User v-if="isDisplay"></User>
</template>

<script>
import { ref } from 'vue'
import User from './components/User.vue'
export default {
  name: 'App',
  components: { User },
  setup() {
    //console.log('setup：安装组合式API')  // 1.首先执行这个
    // data
    let isDisplay = ref(true)
    // 返回对象
    return { isDisplay }
  },
  /* beforeCreate(){
    console.log('beforeCreate')
    console.log('正在初始化选项式API')  // 2.第二步执行这个
  },
  created(){
    console.log('选项式API初始化完成') // 3.最后·执行这个
    console.log('created')
  } */
}
</script>